
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using TGame.ECS;
using UnityEngine;

public class ShopData
{
    public int id;
    public string name;
    public string type;
    public int price;
    public int count;
    public int tag;
    public float timenum;
    public int rank;
    public string des;
    public string icon;
}
public class ShopComponent : ECSComponent
{
    public List<ShopData> shopDatas = new List<ShopData>();
}
public class ShopAwakeSystem : AwakeSystem<ShopComponent>
{
    public override void Awake(ShopComponent c)
    {
        string info = Resources.Load<TextAsset>("ShopConfig").text;
        string[] str = info.Split(new char[] { '\r', '\n' }, System.StringSplitOptions.RemoveEmptyEntries);
        for (int i = 1; i < str.Length; i++)
        {
            ShopData data = new ShopData();
            data.id = int.Parse(str[i].Split(',')[0]);
            data.name = str[i].Split(',')[1];
            data.type = str[i].Split(',')[2];
            data.price = int.Parse(str[i].Split(',')[3]);
            data.count = int.Parse(str[i].Split(',')[4]);
            data.tag = int.Parse(str[i].Split(',')[5]);
            data.timenum = float.Parse(str[i].Split(',')[6]);
            data.rank = int.Parse(str[i].Split(',')[7]);
            data.des = str[i].Split(',')[8];
            data.icon = str[i].Split(',')[9];
            c.shopDatas.Add(data);
        }
        Debug.Log(c.shopDatas.Count);
        Debug.Log(str.Length);
        Debug.Log(c.shopDatas[6].des);
       
    }
}
